package br.com.obardavez.base.service.impl;

import java.io.Serializable;
import java.util.List;

import br.com.obardavez.base.dao.BaseDAO;
import br.com.obardavez.base.entity.BaseEntity;
import br.com.obardavez.base.service.BaseService;

import com.google.inject.persist.Transactional;

public abstract class BaseServiceImpl<T extends BaseEntity> implements BaseService<T> {

	private static final long serialVersionUID = 1L;
	
	public T findById(Serializable id) {
		return getDAO().findById(id);
	}
	
	public List<T> findAll(){
		return getDAO().findAll();
	}

	@Transactional
	public T saveOrUpdate(T obj) {
		return getDAO().saveOrUpdate(obj);
	}
	
	public abstract BaseDAO<T> getDAO();
}
